package com.ruoyi.web.controller.mongodb;

import com.alibaba.fastjson2.JSON;

import com.mongoplus.conditions.query.LambdaQueryChainWrapper;
import com.mongoplus.mapper.BaseMapper;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.mongodb.PointValue;


import com.ruoyi.system.service.PointValueService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.method.P;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/mongodb")
@Slf4j
public class PointValueController extends BaseController {


    @Resource
    private BaseMapper baseMapper;

    @Resource
    private PointValueService pointValueService;



    @GetMapping("/test")
    public AjaxResult getPointValue( PointValue pointValue) {

        PointValue pointValues = pointValueService.lambdaQuery().eq(PointValue::getDeviceId, pointValue.getDeviceId())
                .eq(PointValue::getPointId, pointValue.getPointId()).orderByDesc(PointValue::getCreateTime).one();
        log.error("ERROR [48] =======pointValues =====: " + JSON.toJSONString(pointValues));
        


        return AjaxResult.success(pointValues);
    }


}
